# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
#TODO is this neccesary???
require 'gettext/rails'  
class ApplicationController < ActionController::Base
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_jiandanhua_session_id'
  #   bind textdomin for gettext
  #   parameters
  #   textdomain: 文本域
  #   options:
  #          o :charset - 输出字符集. 缺省是"UTF-8"
  #          o :content_type - 文档类型. 缺省是"text/html"
  #          o :locale_path - locale目录的路径. 缺省是RAILS_ROOT 或者插件的根目录。
  init_gettext "jiandanhua"
  include AuthenticatedSystem
  
  private
  def authorize
    unless session[:user]
      flash[:notice] = "请先登录"
      redirect_to(:controller => :index )
      #return false #为什么还需要return一个false值呢?
    end
  end
  
end
